﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using HRProject.Code.DTO;
using HRProject.Code.DAO;

namespace HRProject
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        private string generatedName;

        public string GeneratedName
        {
            get { return generatedName; }
            set { generatedName = value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                generatedName = Path.GetRandomFileName();
                BLDownloadableFile file = new BLDownloadableFile();
                file.GeneratedName = generatedName;
                file.SessionId = Session.SessionID;
                file.FileName = "dsNhac.xls";
                file.Url = "/attachment/xyz/dsNhac.xls";
                DownloadableFileDAO downloadDao = new DownloadableFileDAO();
                int errorCode = 0;
                int result = downloadDao.Add(file, ref errorCode);
            }
        }
    }
}
